<template>
  <div class="dirlog">
    <div class="qiehuan">
      <button class="textBtn" @click="gotoTextModle">返回首页</button>
    </div>
    <div class="title">
      <div>{{ $globalData.titleName }}</div>
      <div>起重机指挥实操考试自动评判系统</div>
    </div>
    <div class="dirlog_content">
      <div class="dirlog_title">考生信息确认</div>
      <div class="dirlog_tips">
        请仔细核对考试信息，如有错误请告知监考老师！
      </div>
      <div class="dirlog_info">
        <img
          :src="'data:image/jpeg;base64,' + textStudentInfo.signInImage"
          alt=""
        />
        <div class="info">
          <div>准考证号：{{ textStudentInfo.examRegistrationNumber }}</div>
          <div>考生姓名：{{ textStudentInfo.name }}</div>
          <div>
            考生性别：{{
              textStudentInfo.idCard
                ? parseInt(textStudentInfo.idCard.slice(-2, -1)) % 2 === 1
                  ? "男"
                  : "女"
                : "未知"
            }}
          </div>
          <div>证件号码：{{ textStudentInfo.idCard }}</div>
          <div>考试项目：{{ textStudentInfo.projectWork }}</div>
          <div>项目代号：{{ textStudentInfo.projectCode }}</div>
          <div>考试时间：{{ textStudentInfo.examDate }}</div>
          <!-- <div>考试地点：{{ textStudentInfo.workUnit }}</div> -->
        </div>
      </div>
      <div class="dirlog_btn">
        <button class="btn1" @click="againHandleInfo">确认信息</button>
        <button class="btn2" @click="aginHandle">重新认证</button>
      </div>
    </div>
  </div>
</template>

<script>
import screenfull from "screenfull";
import $api from "../untils/api";
export default {
  name: "",
  data() {
    return {
      textStudentInfo: null,
      types: null,
    };
  },
  created() {
    this.textStudentInfo = this.$route.params.textStudentInfo;
    this.types = this.$route.params.types;
  },
  methods: {
    //确认信息
    againHandleInfo() {
      if (this.types == 1) {
        $api.startTrain(this.textStudentInfo.id).then((res) => {
          if (res.data.code == "200") {
            localStorage.setItem("id", res.data.data.examineeId);
          }
        });
      }

      if (screenfull.isEnabled) {
        screenfull.request();
        this.$store.commit("saveStudentinfo", this.textStudentInfo);

        if (this.types == 0) {
          this.$router.push({
            name: "textPage",
          });
        } else if (this.types == 1) {
          this.$router.push({
            name: "textModel",
          });
        }
      }
    },
    //重新认证
    aginHandle() {
      this.$router.push({
        name: "Login",
      });
    },
    gotoTextModle() {
      this.$router.push({
        name: "home",
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.title {
  color: rgb(255, 255, 255);
  font-size: 45px;
  font-weight: bolder;
  width: 700px;
  text-align: center;
  margin: auto;
  padding-top: 200px;
}
.dirlog {
  width: 100%;
  height: 100vh;
  background-image: url(../assets/login/keji2.png);
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.dirlog_content {
  width: 700px;
  height: 600px;
  text-align: center;
  position: fixed;
  left: 17%;
  top: 25%;
  background-color: #fff;
}
.dirlog_title {
  width: 100%;
  height: 60px;
  line-height: 60px;
  color: #fff;
  font-size: 30px;
  font-weight: bold;
  background-color: #1890ff;
}
.dirlog_tips {
  color: #ff6600;
  font-weight: bold;
  font-size: 23px;
  margin: 20px 0;
}
.dirlog_info {
  display: flex;
  justify-content: space-around;
  margin: 20px 0;
}
.dirlog_info > img {
  width: 250px;
  height: 300px;
  margin-top: 20px;
}
.dirlog_info > .info {
  color: #000000;
  font-size: 23px;
  text-align: left;
  margin: 25px 0;
}
.info > div {
  margin: 7px 0;
}
.dirlog_btn {
  display: flex;
  justify-content: space-between;
  width: 400px;
  height: 50px;
  margin: 0 auto;
}
.btn1,
.btn2 {
  border: none;
  width: 150px;
  height: 50px;
  border-radius: 5px;
  font-size: 25px;
}
.btn1 {
  color: #ffffff;
  background-color: #1890ff;
}
.btn2 {
  color: #ffffff;
  background-color: #ff6600;
}
.id_login_btn {
  width: 200px;
  height: 50px;
  margin-top: 100px;
  transform: translateX(-50%);
  margin-left: 50%;
  border: none;
  font-size: 25px;
}

.qiehuan {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 180px;
  height: 60px;
  background-color: #409eff;
  border-radius: 25px;
  position: relative;
  left: 80%;
  top: 3%;
  z-index: 111;
}

.textBtn {
  width: 150px;
  height: 60px;
  font-size: 25px;
  line-height: 60px;
  border: none;
  background-color: #409eff;
  color: #fff;
  border-radius: 5px;
}
</style>
